#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
int n,num[maxn],sum;

bool check()
{
	for(int i=1;i<=n;i++)
		if(num[i]!=-1)
			return false;
	return true;
}

int main()
{
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&num[i]);
	int now=-1,p=0;
	while(sum!=n)
	{
		while(true)
		{
			while(num[p+1]==now&&p<=n) p++;
			while(num[p+1]==-1&&p<=n) p++;
			if(p>n) break;
			if(num[p+1]!=now)
			{
				p++;
				break;
			}
		}
		if(p>n)
		{
			cout<<endl;p=0;now=-1;
			continue;
		}
		printf("%d ",p);now=num[p];num[p]=-1,sum++;
	}
	return 0;
}
/*
12
1 1 0 0 1 1 1 0 1 1 0 0
*/

